package org.springframework.util;

import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;

public abstract class CollectionUtils
{
  public static List arrayToList(Object paramObject)
  {
    return Arrays.asList(ObjectUtils.toObjectArray(paramObject));
  }

  public static boolean contains(Enumeration paramEnumeration, Object paramObject)
  {
    if (paramEnumeration != null);
    do
      if (!paramEnumeration.hasMoreElements())
        return false;
    while (!ObjectUtils.nullSafeEquals(paramEnumeration.nextElement(), paramObject));
    return true;
  }

  public static boolean contains(Iterator paramIterator, Object paramObject)
  {
    if (paramIterator != null);
    do
      if (!paramIterator.hasNext())
        return false;
    while (!ObjectUtils.nullSafeEquals(paramIterator.next(), paramObject));
    return true;
  }

  public static boolean containsAny(Collection paramCollection1, Collection paramCollection2)
  {
    if ((isEmpty(paramCollection1)) || (isEmpty(paramCollection2)));
    Iterator localIterator;
    do
      while (!localIterator.hasNext())
      {
        return false;
        localIterator = paramCollection2.iterator();
      }
    while (!paramCollection1.contains(localIterator.next()));
    return true;
  }

  public static boolean containsInstance(Collection paramCollection, Object paramObject)
  {
    Iterator localIterator;
    if (paramCollection != null)
      localIterator = paramCollection.iterator();
    do
      if (!localIterator.hasNext())
        return false;
    while (localIterator.next() != paramObject);
    return true;
  }

  public static Class<?> findCommonElementType(Collection paramCollection)
  {
    if (isEmpty(paramCollection));
    Object localObject1;
    Object localObject2;
    label52: 
    do
    {
      localObject1 = null;
      while (true)
      {
        return localObject1;
        localObject1 = null;
        Iterator localIterator = paramCollection.iterator();
        while (localIterator.hasNext())
        {
          localObject2 = localIterator.next();
          if (localObject2 != null)
          {
            if (localObject1 != null)
              break label52;
            localObject1 = localObject2.getClass();
          }
        }
      }
    }
    while (localObject1 == localObject2.getClass());
    return null;
  }

  public static Object findFirstMatch(Collection paramCollection1, Collection paramCollection2)
  {
    if ((isEmpty(paramCollection1)) || (isEmpty(paramCollection2)))
      return null;
    Iterator localIterator = paramCollection2.iterator();
    Object localObject;
    do
    {
      if (!localIterator.hasNext())
        return null;
      localObject = localIterator.next();
    }
    while (!paramCollection1.contains(localObject));
    return localObject;
  }

  public static <T> T findValueOfType(Collection<?> paramCollection, Class<T> paramClass)
  {
    Object localObject1;
    if (isEmpty(paramCollection))
      localObject1 = null;
    while (true)
    {
      return localObject1;
      localObject1 = null;
      Iterator localIterator = paramCollection.iterator();
      while (localIterator.hasNext())
      {
        Object localObject2 = localIterator.next();
        if ((paramClass == null) || (paramClass.isInstance(localObject2)))
        {
          if (localObject1 != null)
            return null;
          localObject1 = localObject2;
        }
      }
    }
  }

  public static Object findValueOfType(Collection<?> paramCollection, Class<?>[] paramArrayOfClass)
  {
    Object localObject;
    if ((isEmpty(paramCollection)) || (ObjectUtils.isEmpty(paramArrayOfClass)))
    {
      localObject = null;
      return localObject;
    }
    int i = paramArrayOfClass.length;
    for (int j = 0; ; j++)
    {
      if (j >= i)
        return null;
      localObject = findValueOfType(paramCollection, paramArrayOfClass[j]);
      if (localObject != null)
        break;
    }
  }

  public static boolean hasUniqueObject(Collection paramCollection)
  {
    if (isEmpty(paramCollection))
      return false;
    int i = 0;
    Object localObject1 = null;
    Iterator localIterator = paramCollection.iterator();
    Object localObject2;
    do
      while (true)
      {
        if (!localIterator.hasNext())
          return true;
        localObject2 = localIterator.next();
        if (i != 0)
          break;
        i = 1;
        localObject1 = localObject2;
      }
    while (localObject1 == localObject2);
    return false;
  }

  public static boolean isEmpty(Collection paramCollection)
  {
    return (paramCollection == null) || (paramCollection.isEmpty());
  }

  public static boolean isEmpty(Map paramMap)
  {
    return (paramMap == null) || (paramMap.isEmpty());
  }

  public static void mergeArrayIntoCollection(Object paramObject, Collection paramCollection)
  {
    if (paramCollection == null)
      throw new IllegalArgumentException("Collection must not be null");
    Object[] arrayOfObject = ObjectUtils.toObjectArray(paramObject);
    int i = arrayOfObject.length;
    for (int j = 0; ; j++)
    {
      if (j >= i)
        return;
      paramCollection.add(arrayOfObject[j]);
    }
  }

  public static void mergePropertiesIntoMap(Properties paramProperties, Map paramMap)
  {
    if (paramMap == null)
      throw new IllegalArgumentException("Map must not be null");
    Enumeration localEnumeration;
    if (paramProperties != null)
      localEnumeration = paramProperties.propertyNames();
    while (true)
    {
      if (!localEnumeration.hasMoreElements())
        return;
      String str = (String)localEnumeration.nextElement();
      Object localObject = paramProperties.getProperty(str);
      if (localObject == null)
        localObject = paramProperties.get(str);
      paramMap.put(str, localObject);
    }
  }

  public static <E> Iterator<E> toIterator(Enumeration<E> paramEnumeration)
  {
    return new EnumerationIterator(paramEnumeration);
  }

  private static class EnumerationIterator<E>
    implements Iterator<E>
  {
    private Enumeration<E> enumeration;

    public EnumerationIterator(Enumeration<E> paramEnumeration)
    {
      this.enumeration = paramEnumeration;
    }

    public boolean hasNext()
    {
      return this.enumeration.hasMoreElements();
    }

    public E next()
    {
      return this.enumeration.nextElement();
    }

    public void remove()
      throws UnsupportedOperationException
    {
      throw new UnsupportedOperationException("Not supported");
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     org.springframework.util.CollectionUtils
 * JD-Core Version:    0.6.2
 */